home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 23 / Amiga Format AFCD23 (Feb 1998, Issue 107).iso / -seriously_amiga- / shareware / programming / e / easyplugins / examples / toolbar_demo.e < prev    next >
Text File  |  1997-12-06  |  3KB  |  81 lines

  1.  
  2. /*
  3.  
  4. */
  5.  
  6. OPT PREPROCESS, OSVERSION=37
  7.  
  8. MODULE 'tools/easygui', 'easyplugins/toolbar',
  9.        'utility', 'utility/tagitem'
  10.  
  11. DEF toolbar_h:PTR TO toolbar_plugin,
  12.     toolbar_v:PTR TO toolbar_plugin,
  13.     toolbar_b:PTR TO toolbar_plugin,
  14.     disabled=FALSE
  15.  
  16. PROC main() HANDLE
  17.  
  18.     IF (utilitybase:=OpenLibrary('utility.library', 37))=NIL THEN Raise("util")
  19.  
  20.     NEW toolbar_h.toolbar([PLA_ToolBar_Contents, ['Horizontal,', 'not all gadgets', 'are forced', 'to appear', 'up here.'],
  21.                            PLA_ToolBar_Function, {gadget_pressed},
  22.                            TAG_DONE])
  23.  
  24.     NEW toolbar_v.toolbar([PLA_ToolBar_Contents, ['This is', 'a vertical', 'toolbar,',
  25.                                                   'all gadgets', 'forced to', 'appear.'],
  26.                            PLA_ToolBar_Function, {gadget_pressed},
  27.                            PLA_ToolBar_Vertical, TRUE,
  28.                            PLA_ToolBar_DisplayAll, TRUE,
  29.                            TAG_DONE])
  30.  
  31.     NEW toolbar_b.toolbar([PLA_ToolBar_Contents, ['This is', 'a vertical', 'toolbar,',
  32.                                                   'not all gadgets', 'are forced', 'to appear.',
  33.                                                   'In fact', 'it\as', 'just a waste', 'of space.' ],
  34.                            PLA_ToolBar_Function, {gadget_pressed},
  35.                            PLA_ToolBar_Vertical, TRUE,
  36.                            TAG_DONE])
  37.  
  38.     easyguiA('toolbar_plugin example', [ROWS,
  39.                                            [BEVELR,
  40.                                                [PLUGIN, NIL, toolbar_h, TRUE]
  41.                                            ],
  42.                                            [COLS,
  43.                                                [ROWS,
  44.                                                    [BEVELR,
  45.                                                        [PLUGIN, NIL, toolbar_v, TRUE]
  46.                                                    ],
  47.                                                    [SPACEV]
  48.                                                ],
  49.                                                [BEVELR,
  50.                                                    [PLUGIN, NIL, toolbar_b, TRUE]
  51.                                                ],
  52.                                                [SPACE],
  53.                                                [CHECK, {toggle_disabled}, '_Disabled?', disabled, FALSE, -1, "d"]
  54.                                            ]
  55.                                        ])
  56.  
  57. EXCEPT DO
  58.  
  59.     END toolbar_h, toolbar_v, toolbar_b
  60.  
  61.     IF utilitybase THEN CloseLibrary(utilitybase)
  62.  
  63. ENDPROC
  64.  
  65. PROC toggle_disabled()
  66.  
  67.     IF disabled THEN disabled:=FALSE ELSE disabled:=TRUE
  68.  
  69.     toolbar_h.set(PLA_ToolBar_Disabled, disabled)
  70.     toolbar_v.set(PLA_ToolBar_Disabled, disabled)
  71.     toolbar_b.set(PLA_ToolBar_Disabled, disabled)
  72.  
  73. ENDPROC
  74.  
  75. PROC gadget_pressed(toolbar:PTR TO toolbar_plugin, gad_num)
  76.  
  77.     WriteF('You pressed gadget number \a\d\a on toolbar $\h.\n', gad_num, toolbar)
  78.  
  79. ENDPROC
  80.  
  81.